<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['系统配置','传感器状态']" icon="fa fa-cog" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>传感器状态</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module">																	 							
									<span class="module_text">公司名称</span>	
									<sa-company-tree companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree>										
								</div>
								<div class="top_module" style="border: 1px solid #ccc;border-radius:4px;overflow: hidden;">
									<span class="module_text" style="line-height: 26px;border-radius: 0;vertical-align:top;">传感器状态
									</span><select class="form-control" [(ngModel)]="status"  style="vertical-align:middle;display: inline-block; width:108px;height: 26px;line-height: 26px;padding: 0 12px;border:none;">
										<option value="0">全部</option>
										<option value="1">无异常</option>
										<option value="2">有异常</option>
									</select>
								</div>
								<button type="button" class="btn btn-primary" (click)="table_search()">查询</button>								
							</div>
							
							<div class="right top-search" style="width: 240px;">
								<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input" placeholder="公司名称、设备ID、车牌号码...">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>车牌号码</th>
										<th>设备ID</th>
										<th>所属公司</th>
										<th>传感器通道[在用]</th>
										<th>传感器通道[异常]</th>
										<!--<th>异常详情</th>-->
										<th>传感器通道[全部]</th>
										<th>描述</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData" >
										<td>{{row.carNumber}}</td>
										<td>{{row.deviceId}}</td>
										<td>{{row.companyName}}</td>
										<td>
											<span  class="channel-style bg-green" *ngFor="let item of row.userChannels">{{item}}</span>
										</td>
										<td>
											<span  class="channel-style bg-red" *ngFor="let item of row.damageChannels">{{item}}</span>
											<button type="button" *ngIf="row.damageChannelsSize" (click)="sensorDetail(row,sensorModal)">查看</button>
										</td>
										<td>
											<span  class="channel-style bg-normal" *ngFor="let item of row.allChannels">{{item}}</span>
										</td>
										<td>{{row.remark}}</td>
										<td>
											<button type="button" (click)="resetSensor(row,resetModal)">重置</button>
											<button type="button" (click)="delSensor(row)">删除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!-- 异常传感器详情    弹窗-->
	<div bsModal #sensorModal="bs-modal" id="sensorModalID" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content" style="width: 800px;">
				<div class="modal-header">
					<button type="button" class="close" (click)="cancelsensor(sensorModal)" aria-label="Close">
	            		<span aria-hidden="true">&times;</span>
	          		</button>
					<h4 class="modal-title">传感器检查记录</h4>
				</div>
				<div class="modal-body table_scroll ">
					<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
						<thead>
							<tr>
								<th>检查起始时间</th>
								<th>检查结束时间</th>
								<th>损害通道</th>
								<th>曲线图</th>
							</tr>
						</thead>
						<tbody>
							<tr *ngFor="let row of unnormalSensor" >
								<td>{{row.checkStartDate}}</td>
								<td>{{row.checkEndDate}}</td>
								<td>
									<span  class="channel-style bg-red" *ngFor="let item of row.damageChannels">{{item}}</span>
								</td>
								<td>
									<button type="button" (click)="ad_map(row)">查看</button>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div id="ad_map" style="height: 280px;"></div>
				<!--<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="cancelAudit(sensorModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="auditSubmit(sensorModal)">确认</button>
				</div>-->
			</div>
		</div>
	</div>
	<!--异常传感器详情  end-->
	
	<!-- 重置    弹窗-->
	<div bsModal #resetModal="bs-modal" id="resetSensorModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="cancelReset(resetModal)" aria-label="Close">
	            <span aria-hidden="true">&times;</span>
	          </button>
					<h4 class="modal-title">重置原因</h4>
				</div>
				<div class="modal-body">
					<div class="row form-horizontal">
						<label class="radio radio-inline" style="padding-top: 0;">
	                        <input type="radio" class="radiobox" [(ngModel)]='resetReason' (change)="resetReasonChange($event.target.value)" value='1' name="maintain">
	                        <span>维修</span>
	                    </label>
	                    <label class="radio radio-inline" style="padding-top: 0;">
	                        <input type="radio" class="radiobox" [(ngModel)]='resetReason' (change)="resetReasonChange($event.target.value)" value='2' name="misjudge">
	                        <span>误判</span>
	                    </label>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="cancelReset(resetModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="resetSubmit(resetModal)">提交</button>
				</div>
			</div>
		</div>
	</div>
	<!--重置  end-->
	
</div>
